<?php 
$args = null;
$num_post		= -1;
$post_type		= 'gallerys'; 
$orderby		= 'date';
$order			= 'DESC';
$meta_key		= $wpdb->prefix.'display';
$meta_value		= 'display';
$args = db_query_all_post_in_post_type($num_post, $post_type, $orderby, $order, $meta_key, $meta_value);					
$query = new WP_Query($args);
?>

<div class="galery">
                    	<span class="icon-galery"></span><h3>Gallery</h3>
                        <span class="icon-soc-galery"></span>
                    	<div class="clear"></div>
                        <div id="slideshow"> <!--slideshow-->
            <div class="rows-2">
              <ul id="mycarouse2" class="jcarousel-skin-tango">
              	 <?php                     
                    if($query->have_posts())
                    {
                    	while ($query->have_posts())
                    	{
                    		$query->the_post();
                    		$post_id = get_the_ID();
                    		$title = get_the_title($post_id);
                    		$myurl = get_post_meta($post_id,$wpdb->prefix.'url',true);
                    		$thumbnail = db_get_post_meta($post_id, $wpdb->prefix.'thumbnail');
                    		$alt = db_get_alt_attachment_id($post_id, $wpdb->prefix.'thumbnail');
                    		if(!$alt)
                    			$alt = db_vietnamese_slug($title);
                    		?>
                    		<li>
			                	<div class="bg-galery">
			                    	<a href="<?php echo $myurl;?>">
			                    	<img src="<?php echo $thumbnail;?>" alt="<?php echo $alt;?>" /></a>
			                    </div>
			                </li>
                    		<?php 	
                    	}
                    	wp_reset_query();
                    }
                    else 
                    {
                    	echo 'No found!';
                    }
                    ?> 
              
              </ul>
            </div>
          </div>    
</div>